<!-- 整改方案 -->
<template>
  <a-spin tip="正在导出,请等待..." size="large" :spinning="loading" style="font-size: 18px">
  <div class='lanjian-content pt8'>
    <a-tabs v-model="activeKey" type='editable-card' border="false" hide-add
            foldbtn="false">
      <a-tab-pane key="1" tab="总体情况" :closable="false">
      </a-tab-pane>
      <a-tab-pane key="2" tab="整改方案" :closable="false">
      </a-tab-pane>
      <a-tab-pane key="4" tab="评估情况" :closable="false">
      </a-tab-pane>
      <a-tab-pane key="3" tab="提交记录" :closable="false">
      </a-tab-pane>
<!--      <a-button v-show="activeKey === '1'" class="m-r-8"  slot="tabBarExtraContent" type="primary" title='保存' @click="save">
        <span class='icon iconfont'>&#xe668;</span>
      </a-button>-->
      <a-button slot="tabBarExtraContent" type="primary" @click="exportFile" title="导出提报">
        <span class='icon iconfont'>&#xe6bf;</span>
      </a-button>
    </a-tabs>
    <div v-if="activeKey === '1'" class="tabs-content">
      <Total ref="total"></Total>
    </div>
    <div v-if="activeKey === '4'" class="tabs-content">
      <Status ref="Status"></Status>
    </div>
    <div v-if="activeKey === '2'" class="tabs-content" >
      <adetails ref="ad"></adetails>
    </div>
    <div v-if="activeKey === '3'" class="tabs-content">
      <ApprovalHistory :data-source="[]"></ApprovalHistory>
    </div>
    <Tibao :visible.sync="visible" @save="exportFile"></Tibao>
  </div>
  </a-spin>
</template>

<script>
import adetails from './adetails';
import RectificationPlan from './RectificationPlan';
import Total from './Total.vue';
import Status from './Status.vue';
import ApprovalHistory from './ApprovalHistory';
import {getNowMilliSecond, getSystemDir} from "@/utils/common";
import {exportModule, mkdir, setPlanExtime} from "@/utils/fileUtils";
import fs from "fs";
import {getJLID} from "@/utils/JsonTools";
import Tibao from '@/components/Tibao.vue';

export default {
  name: 'index',
  components: {
    Tibao,
    adetails, RectificationPlan, ApprovalHistory,Total,Status
  },
  data() {
    return {
      loading:false,
      m_status:"",
      activeKey: '1',
      visible:false
    };
  },
  mounted() {
  },
  methods: {

    save(){
      this.$refs.total.save()
    },
    exportTibao(){
      this.visible=!this.visible
    },
    exportFile() {
      this.loading=true
      let foldid=getNowMilliSecond()
      let dir=getSystemDir()
      console.log("pp--s--",dir)
      mkdir(dir)
      mkdir(dir+"\\"+foldid)
      exportModule(2,dir+"\\"+foldid).then(res=>{
        this.loading=false
        if(res==0){
          this.$message.error('导出失败')
          return
        }
        if(res==1){
          setPlanExtime()
          this.$message.success('导出成功')
          this.$refs.ad.reset()
          return
        }
        this.$message.warn('未完成数据填报，无法导出提报')
      })
    }
  },
};
</script>
<style lang="less" scoped>
/deep/ .ant-tabs-nav-scroll {
  float: left;
}
</style>
